home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 12 / BBS in a box XII-1.iso / Files / Bus / S / S7P 3.6 Manual.sit / S7P 3.6 Manual.rsrc / TEXT_144.txt < prev    next >
Encoding:
Text File  |  1993-11-14  |  15.5 KB  |  305 lines

  1. Appendix A: Built-in Event Handling
  2.  
  3. System 7 Pack‚Ñ¢ has built-in handlers for the following AppleEvents:
  4.  
  5. 'misc','dosc'    
  6. This is the standard 'do script' command. It will execute any 4D command sent with it. An optional parameter 'ACK0', which should be 1 or 0 specifies whether an acknowledgment should be sent after the command executes.
  7.  
  8. 'ISIS','CFIL'
  9. Count Files - returns the number of files.
  10.  
  11. 'ISIS','CFLD'
  12. Count Fields - returns the number of fields in the file specified by the direct object which must be numeric (either long or short integer).
  13.  
  14. 'ISIS','FNAM'
  15. File Name - returns the name of the file specified by the direct object which must be numeric.
  16.  
  17. 'ISIS','FINF'
  18. Field Info - returns the name and type of a field. The file number is specified by the direct object and the field number is given by the key 'FNUM'. Both of these must be numeric. The field name is returned as the direct object of the reply and the field type (an integer as returned by 4D's "type" function) is returned with the key 'FTYP'.
  19.  
  20. 'ISIS','RECS'
  21. Returns the number of records in the selection of the file specified by the direct object.
  22.  
  23. 'ISIS','RECN'
  24. Returns the current record number of the file specified by the direct object.
  25.  
  26. 'ISIS','GETF'
  27. Returns the contents of a field in the current record. The direct object specifies the file number and the field number is given by the key 'FNUM'.
  28.  
  29. 'ISIS', 'ACK0'
  30. This is optionally sent by 4D¬Æ as an acknowledgment after a 'do script' command is completed. The direct object is a numeric result code with any 4D¬Æ error that occurred when executing the command.
  31.  
  32. All of these events will return a descriptive error message in the 'errs' parameter if any errors occur. The reply will be one of the following: "Bad File Number", "Bad Field Number", "Bad Record Number", or "No Current Record". In order to accept these AppleEvents, you must execute the command AllowAccess(1).
  33.  
  34. Appendix B: Sample Programs
  35. Your System 7 Pack‚Ñ¢ disk includes several demo programs which illustrate how to use most of the features.
  36.  
  37. S7P Demo DB is System 7 Pack‚Äôs on-line reference and demo database. It includes a complete listing of all commands in System 7 Pack in a HyperCard-like format in addition to demos of most of System 7 Pack‚Äôs features. There are also several useful 4D procedures which you can copy to your own databases. See Appendix D for a description of several functions which create and send some of the core AppleEvents.
  38.  
  39. Here‚Äôs a brief description of the menu commands:
  40. ‚Ä¢    List Commands: Displays a list of System 7 Pack‚Äôs commands. Double-clicking on a command name will open up a HyperCard-like information window.
  41. ‚Ä¢    Export to Word: Creates a list of System 7 Pack‚Äôs commands as a formatted MS Word¬Æ file and then uses System 7 Pack to open the document in Word.
  42. ‚Ä¢    Frontier Demo: Sends a few simple commands to UserLand Frontier‚Ñ¢, which must be already running.
  43. ‚Ä¢    AppleScript Demo: Allows you to type in a script and execute it with AppleScript.
  44. ‚Ä¢    Finder Demo: Demonstrates how to send AppleEvents to the Finder.
  45. ‚Ä¢    Excel 4.0: Demonstrates how to send data to Excel¬Æ 4.0,  request different types of charts in Excel, and convert Excel charts to a picture in 4D.
  46. ‚Ä¢    Send & Recv List: Demonstrates how to send and receive arrays using the low-level functions. For the receiver, you must select either your own copy of 4D or another one on the network running this same demo.
  47. ‚Ä¢    On Location: Demonstrates how to send AppleEvents to On Location¬Æ.
  48. ‚Ä¢    ISIS Notes Demo: Demonstrates how to control ISIS Notes‚Ñ¢ by sending AppleEvents to look up users, send a note, and send a file.
  49. ‚Ä¢    Client/Server menu: Implements a name & address lookup server. Use one of the client applications described below to send lookup requests.
  50.  
  51. Address Client demonstrates one way 4D¬Æ can provide data to a client application. The 4D application provides a minimal address file which responds to AppleEvents (class "ISIS" id "FIND") which request a name lookup. Any text passed via the lookup request will trigger a Search on the name field of the address file. The full address will be returned in an event of class "ISIS" and id "REPL". Address Client is a tiny (28k) stand-alone application which simply sends lookup requests to the 4D¬Æ application and displays the results. Address Client Stack is a HyperCard¬Æ 2.1 stack which works exactly the same as the application. FM Pro Client is a sample client written in FileMaker¬Æ Pro 2.0. This one sends a different request to 4D and gets back a series of Create Element events to create records containing the results.
  52.  
  53. Appendix C: Error Codes
  54.  
  55.  
  56. All System 7 Pack‚Ñ¢ functions will return 0 if the operation is completed successfully. Some applications may return codes not listed here if they're unable to handle an AppleEvent sent to them. Also, any possible system error code can be returned (for a complete list, see Bill Steinberg‚Äôs ‚ÄúSystem Errors DA‚Äù). Other possible results are:
  57.  
  58. -1  An invalid signature or target address handle was given
  59. -2  You're not running System 7 or your system doesn't support AppleEvents
  60. -3     The specified application isn't running.
  61. -4     Incompatible array type (PutList or GetList).
  62. -10     Handler for that event is already present (InstallAEVT).
  63. -20     Attempted to replace standard event handler (InstallAEVT).
  64. -30     Attempted to remove event handler we didn't install (IgnoreAEVT).
  65. -35     Couldn't find application to launch on any volume.
  66. -43     Couldn't find document to open or print.
  67. -100     Unable to install AppleEvent handler proc (InstallAEVT).
  68. -108     Not enough memory to launch an application.
  69. -606     Attempt to bring background-only application to front. (BringToFront).
  70. -906     Attempt to send AppleEvent to non-aware application. (usually PrintDoc).
  71. -1700     Incompatible data type in an AppleEvent parameter.
  72. -1701     Parameter not found in the AppleEvent.
  73. -1702-1707     Not a valid AppleEvent or invalid parameter.
  74. -1708     Receiving application couldn‚Äôt handle that AppleEvent.
  75. -1709     Reply wasn‚Äôt valid.
  76. -1710     Unknown send mode.
  77. -1711     Wait for reply cancelled by user.
  78. -1712     Timed out waiting for reply.
  79. -1713     Required user interaction but none was allowed.
  80. -1715     Required parameter wasn‚Äôt accessed.
  81. -1716     Invalid target address.
  82. -1718     Attempted to access reply which hasn‚Äôt arrived yet.
  83. -1753     General AppleScript error (usually syntax error in script).
  84.  
  85. Appendix D: AppleEvent Registry
  86.  
  87. Fully describing all of the standard AppleEvents is beyond the scope of this manual, but here are some of the more common events defined by Apple in the required, core, and miscellaneous standard suites of the AppleEvent registry:
  88.  
  89. Open Application  aevt    oapp    Sent by the finder when an application is opened with no documents. You shouldn‚Äôt send this event.
  90.  
  91. Open Document    aevt    odoc    Tells an application to open a list of documents.
  92.  
  93. Print Document    aevt    pdoc    Tells the application to open and print one or more documents.
  94.  
  95. Quit    aevt    quit    Tells the application to quit.
  96.  
  97. Close    core    clos    Closes the specified objects.
  98.  
  99. Delete    core    delo    Deletes the specified objects.
  100.  
  101. Do Objects Exist    core    doex    Determines if the specified objects exist.
  102.  
  103. Get Class Info    core    qobj    Get information about a particular object class.
  104.  
  105. Get Data    core    getd    Get data from the specified objects.
  106.  
  107. Get Data Size    core    dsiz    Get the size of specified objects.
  108.  
  109. Get Event Info    core    gtei    Get information about a particular AppleEvent.
  110.  
  111. Save    core    save    Save the specified objects.
  112.  
  113. Set Data    core    setd    Change the specified objects.
  114.  
  115. Do Script    misc    dosc    Executes commands in the application's specific language.
  116.  
  117. Evaluate    misc    eval    Evaluates an expression and returns the results.
  118.  
  119. Here some of the more common class names and property IDs:
  120.  
  121. Cell    ccel
  122. Column    ccol
  123. Document    docu
  124. File    file
  125. Graphic object    cgob
  126. Menu    cmnu
  127. Paragraph    cpar
  128. Row    crow
  129. Selection    csel
  130. Table    ctbl
  131. Window    cwin
  132. Word    cwor
  133. Best type (property)    pbst
  134. Bounds (property)    pbnd
  135. Class (property)    pbnd
  136. Color (property)    colr
  137. Default type    deft
  138. Font (property)    font
  139. Name (property)    pnam
  140. Point Size    ptsz
  141. Version    vers
  142.  
  143. The sample database, S7P Reference, includes the following functions which  create and send some of the more common core events:
  144.  
  145. Err:=Create Element(Target;Class;Container;Position)
  146. Creates a new element of the specified class. Specify 0 for container and "" (a null string) for position if no value needs to be given.
  147.  
  148. Result:=Do ObjectsExist(Target;Object)
  149. Returns TRUE if the specified objects exist.
  150.  
  151. Err:=Get Text(Target;Object;¬ªdata)
  152. Err:=Get Pict(Target;Object;type;¬ªdata)
  153. Err:=Get Array(Target;Object;type;¬ªdata)
  154. Returns the value of an object or object property. Type should be a 4-letter string specifying the data type to be returned. It should be one of ‚ÄúTEXT‚Äù, ‚ÄúLIST‚Äù, ‚ÄúPICT‚Äù, or ‚ÄúSPIC‚Äù. ‚ÄúSPIC‚Äù is only used with Excel¬Æ 4.0 and is the same as PICT except it will return a color screen picture rather than a dithered print image picture. Data should be a pointer to a variable of the appropriate type.
  155.  
  156. NOTE: Rather than using a single procedure, we‚Äôve provided separate procedures for the most common data types to make them compatible with the 4D compiler. 
  157.  
  158. Err:=Send Text(Target;Object;Data)
  159. Err:=Send Array(Target;Object;¬ªArray)
  160. Err:=Send Enum(Target;Object;Value)
  161. Changes the value of an object or object property. 
  162.  
  163. Examples:
  164. Err:=Send Text(Excel;Property(‚Äúsele‚Äù;Obj(‚Äúdocu‚Äù;0;1));‚ÄùR1C1:R10C1‚Äù)
  165. Selects cells R1C1 thru R10C1 in the topmost worksheet.
  166.  
  167. Err:=Send Array(Excel;ObjNamed(‚Äúcrng‚Äù;Obj(‚Äúdocu‚Äù;0;1);‚ÄùR1C4:R10C4‚Äù);¬ªaList)
  168. Sends an array of numbers to a range in the topmost worksheet.
  169.  
  170. Err:=Get Pict(Excel;Obj(‚Äúchrt‚Äù;Obj(‚Äúdocu‚Äù;0;1);1);‚ÄùSPIC‚Äù;¬ªaChart)
  171. Copies the first chart in the topmost worksheet to a color picture.
  172.  
  173. Err:=Create Data(Excel;‚Äùchrt‚Äù)
  174. Creates a new chart document.
  175.  
  176. HasChart:=Do ObjectsExist(Excel;Obj(‚Äúchrt‚Äù;Obj(‚Äúdocu‚Äù;0;1);1))
  177. Returns TRUE if the topmost worksheet contains a chart.
  178.  
  179. For more information, see the latest edition of the AppleEvent Registry, available from Apple Computer, Inc and the Excel Software Development Kit, available from Microsoft Press. Many AppleEvent aware applications include a description of the supported events in their manul. You may also be able to get additional information from the software publisher.
  180.  
  181. Appendix E: Network Access
  182.  
  183. Before you can send AppleEvents across the network you must configure any machines you wish to be able to access. Any machine which needs to receive remote AppleEvents must have ‚ÄúProgram Linking‚Äù turned on through the Sharing Setup control panel. In addition, any machine you wish to connect to should have an entry in the Users & Groups file for you (optionally, if security isn‚Äôt a concern, you can simply turn on the program linking checkbox for guests by double-clicking the <Guest> icon in the Users & Groups control panel). The first time you send an AppleEvent to a program on a remote Macintosh you will be asked to suply a user name and password. If guest access is enabled, you can simply click on the ‚ÄúGuest‚Äù button.
  184.  
  185. Appendix F: Quick Reference
  186.  
  187. L :=    AddrToString(Target;String1;String2;String3)
  188. L :=    AESend(Target;Class;ID;Text)
  189. L :=    AESendPict(Target;Class;ID;Picture)
  190.     AllowAccess(N)
  191. L :=    AppleScript(Text;Reply)
  192. L :=    BringToFront(Signature)
  193. L :=    CreateAERec(AERec )
  194. L :=    CreateAEVT(Class;ID;Target;AEVT)
  195. L :=    CreateXAEVT(Class;ID;Target;N;L;AEVT)
  196. L := Coerce(AERec;Str4)
  197. ospec := Comparison(Str4;container ospec;test ospec;Str4;String)
  198. L :=    CopyDesc(AEVT or Target or OSPEC or AERec)
  199. L :=    DisposeAddress(Target)
  200. L :=    DisposeDesc(AEVT or Target or OSPEC or AERec)
  201. L :=    DoScript(Target;Text)
  202. L :=    Evaluate(Target;Text;Reply)
  203. L :=    FindAppName(Signature;Name)
  204. L :=    FindCreator(Name;Signature)
  205. L :=    FinderOpen(Name);
  206. L :=    Frontier(Text;Reply)
  207. L :=    GetAEInfo(AEVT;NumOfItems;ArrayOfStr4;ArrayOfStr4;ArrayOfLong)
  208.     GetAEMessage(Text)
  209. L :=    GetAEPict(Picture Variable)
  210. L :=    GetAERecord(AEVT;Str4;AERec)
  211.     GetAEType(Type String)
  212. L :=    GetAliasParam(AEVT ;Str4;String)
  213. L := GetBoolean(AEVT;Str4;aBoolean)
  214. L :=    GetComponent(Str4)
  215. L :=    GetKeyword(AEVT;Str4;Str4)
  216. L :=    GetList(AEVT;Str4;anyArray)
  217. L :=    GetNthDesc(AEVT;integer;Str4;Str4;Long)
  218. L :=    GetNthItem(AEVT;integer;Str4;Str4;Text)
  219. L :=    GetRealParam(AEVT;Str4;aRealNum)
  220. L :=    GetReturnID(AEVT)
  221. L :=    GetShortParam(AEVT;Str4;Str4;L)
  222. L :=    GetTransactionID(AEVT)
  223. L :=    GetPicParam(AEVT;Str4;N;aPicture)
  224.     GetReturnAddr(Target)
  225. L :=    GetShortParam(AEVT;Str4;Str4;N)
  226. L :=    GetTextParam(AEVT;Str4;Text)
  227. L :=    HandleAEVT(Class;ID;Name)
  228. L :=    IgnoreAEVT(Class;ID)
  229. L :=    IsRunning(Signature)
  230. L :=    IsVersion3
  231. L :=    Launch(Signature;Name)
  232. L :=    LaunchBehind(Signature;Name)
  233. L :=    ListComponents(Str4;Long;StrArray;TextArray)
  234. L :=    Long(Str4)
  235. L :=    MakeAddress(Signature;Target)
  236. ospec :=    Obj(Str4;ospec ;L)
  237. ospec :=    ObjNamed(Str4;ospec;String)
  238. ospec := ObjX(Str4;ospec;Str4)
  239. L :=    PrintDoc(Signature;Name)
  240.     ProcessAEVT
  241. L :=    ProcessList(N;ArrayOfString)
  242. ospec :=    Property(Str4;ospec)
  243. L :=    PutAERecord(AEVT;Str4;AERec )
  244. L :=    PutAliasParam(AEVT;Str4;Name)
  245. L := PutBoolean(AEVT;Str4;aBoolean)
  246. L :=    PutKeyword(AEVT;Str4;Str4)
  247. L :=    PutList(AEVT;Str4;Str4;anyArray)
  248. L :=    PutLongParam(AEVT;Str4;Str4;L)
  249. L :=    PutObject(AEVT;Str4;ospec)
  250. L :=    PutPicParam(AEVT;Str4;N;aPicture)
  251. L :=    PutRealParam(AEVT;Str4;aRealNum)
  252. L :=    PutShortParam(AEVT;Str4;Str4;N)
  253. L :=    PutTextParam(AEVT;Str4;Text)
  254. L :=    SendAppleEvent(AEVT;ReplyAEVT;L;L)
  255. L :=    SetComponent(Str4)
  256. L :=    QuicKeys(Name)
  257. L :=    QuitApp(Signature)
  258. L :=    S7Version(Name)
  259. L :=    SelectAddress(Name,Signature;Target)
  260. L :=    SendWithReply(Target;Class;ID;Text;Reply)
  261.     SetTimeOut(N)
  262. L :=    StringToAddress(String1;String2;String3;Target)
  263. L :=    System7
  264.  
  265. ______________________________________
  266.  L:    a Long Integer value
  267.  N:    an Integer value
  268.  Name:    a string variable or field
  269.  Signature:    4 character application signature
  270.  Class,ID:    4 character strings
  271.  Text:    a Text variable or field
  272.  Reply:    a Text variable or field
  273.  AEVT:    a Long Integer representing an AppleEvent
  274.  AERec:    a Long Integer representing an AERecord
  275.  ospec:    a Long Integer representing an Object Specifier
  276.  Target:    a Long Integer representing a target address
  277.  ospec:    an object specifier
  278.  
  279. Appendix G: Version History
  280.  
  281. Version 1.0 - Dec. 1991 Initial release.
  282.  
  283. Version 2.0 - Feb. 1992 Added Frontier & QuicKeys support, Built-in AppleEvent handlers.
  284.  
  285. Version 3.0 - May 1992 Added low-level commands. Many new commands added but compatibility maintained with 2.0. Procedure Editor now lists commands in logical groupings. Demo programs completely rewritten.
  286.  
  287. Versoion 3.1 - June 1992 Added AE Record support, needed for Claris Resolve.
  288.  
  289. Version 3.1.1 - June 1992 Fixed problem with StringToAddress
  290.  
  291. Version 3.2 - July 1992 Added Long() utility function & demos for Excel 4.0
  292.  
  293. Version 3.26 - Sep. 1992 Added LaunchBehind command. Added many new commands for examining AppleEvents and provide more access to internal features for custom extensions to S7P.
  294.  
  295. Version 3.3 - Nov. 1992 Compatibility with 4D¬Æ Version 3.0.
  296.  
  297. Version 3.4 - Apr. 1993 Compatibility with 4D¬Æ 3.0.3‚Äôs new AppleEvent handling & support for AppleScript.
  298.  
  299. Version 3.4.2 - June 1993 Minor compatibility changes for final release of 3.0.3 & 3.0.4. Maintains compatibility with 4D 2.2.3 but removes 3.0.1/3.0.2 compatibility.
  300.  
  301. Version 3.4.3 - August 1993 Adds FinderOpen command for cleaner application launching. PutList now accepts a 2 dimensional array. PutAlias now supports remote aliases.
  302.  
  303. Version 3.5 - Sep. 1993 Added GetBoolean & PutBoolean commands. Improved AppleScript and Open Scripting Architecture support. AppleScript command now returns the script result. SetComponent & GetComponent commands provide a way to change the default scripting language. ListComponents can get information about components of any type.
  304.  
  305. Version 3.6  - Nov. 1993 Added Coerce, ObjX, and Comparison commands to simplify certain tasks in Now Up-To-Date and FileMaker Pro.